import React, { useEffect, useState } from 'react';
import { useParams } from 'react-router-dom';
import axios from 'axios'
import './index.css'
const Index = () => {
    let Params = useParams()
    const [detail, setDetail] = useState([])
    const getDetail = async (id) => {
        var res = await axios.get(`http://122.112.161.135:4000/api/movieDetail?id=${id}`)
        console.log(res.data.res[0]);
        setDetail(res.data.res[0])
    }
    useEffect(() => {
        var { id } = Params
        getDetail(id)
    });
    return (
        <div className='page'>
            <img src={detail.pic} alt="" />
            <h2>{detail.title}</h2>
            <p>{detail.slogo}</p>
            <p>{detail.rating}</p>
        </div>
    );
}

export default Index;
